#include <string>
#include <vector>
#include <ranges>
#include <iostream>
#include <algorithm>

using namespace std;

class Person
{
public:
	Person(string first, string last)
			: m_firstName{move(first)}, m_lastName{move(last)} {}

	const string &getFirstName() const { return m_firstName; }
	const string &getLastName() const { return m_lastName; }

private:
	string m_firstName;
	string m_lastName;
};

int main()
{
	vector persons{Person{"John", "White"}, Person{"Chris", "Blue"}};

	//Since the class does not implement operator<, 
	//you cannot sort this using the Person vector normal std::sort()

	//sort(begin(persons), end(persons)); // Error: does not compile.
	// ranges::sort(persons); // Error: does not compile.

	// ranges::sort(persons, {},
	//	[](const Person& person) { return person.getFirstName(); });
	//  Or:
	ranges::sort(persons, {}, &Person::getFirstName);

	for (const auto &person : persons)
	{
		cout << person.getFirstName() << endl;
	}
}
